package org.lc.stk.model.question.impl.fillBlank;

import org.hibernate.annotations.Comment;
import org.lc.stk.model.question.Answer;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Lob;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;

/**
 * 填空题答案，支持富文本格式以便存储公式、图片等
 */
@Entity
@Table(name = "fill_blank_answers")
@Comment("填空题答案")
public class FillBlankAnswer extends Answer {
    
    @Lob
    @NotBlank(message = "答案内容不能为空")
    @Column(name = "content")
    @Comment("富文本答案内容")
    private String body;
    
    @Min(value = 1, message = "填空位序号必须大于0")
    @Column(name = "blank_index")
    @Comment("填空位序号")
    private int blankIndex;
    
    @ManyToOne
    @Comment("所属题目")
    private FillBlankQuestion question;
    
    public String getBody() {
        return body;
    }
    
    public void setBody(String content) {
        this.body = content;
    }
    
    public int getBlankIndex() {
        return blankIndex;
    }
    
    public void setBlankIndex(int blankIndex) {
        this.blankIndex = blankIndex;
    }
    
    public FillBlankQuestion getQuestion() {
        return question;
    }
    
    public void setQuestion(FillBlankQuestion question) {
        this.question = question;
    }
}